package cate.game.role.farm.tower.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTower;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "美食神殿通关奖励领取请求")
@OperationSetter(value = GDOperation.TOWER_REWARD, sub = "tid")
public class TowerRewardReq implements MsgInput {
    @NoteField(value = "奖励tid")
    public int tid;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult<Void> r = cc.getRole().getFarm().tower.getReward(tid);
        if(!r.ok()){
            game.notice.message(cc.getRole(), r.message);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTower.REWARD_REQ;
    }
}
